package team.star.werespos.model.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Objects;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * PermissionController class<br/>
 *
 * @author hdonghong
 * @since 2018/04/30
 */
@TableName("`permission`")
@Data
@Accessors(chain = true)
public class Permission implements Serializable {

    @TableId
    private Integer pid;

    private String pname;

    private String premarks;

//    private Set<Role> roles;

    public Permission() {
//        roles = new HashSet<>();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof Permission)) {
            return false;
        }
        Permission o2 = (Permission) obj;
        return (Objects.equals(this.getPid(), o2.getPid()));
    }

    @Override
    public int hashCode() {
        int hash = 17;
        hash = hash << 5 - hash + (pid == null ? 0 : pid);
        return hash;
    }
}
